import Vue from 'vue'
import App from './App.vue'
import ElementUI from "element-ui";
import 'element-ui/lib/theme-chalk/index.css';
import router from './router/index.js';
import store from '@/vuex/store.js';
import './assets/reset.css';
import VueRouter from "vue-router";
import Crumbs from '@c/Crumbs.vue';
import echarts from 'echarts';
Vue.prototype.$echarts  = echarts;
Vue.component('Crumbs',Crumbs);
Vue.use(ElementUI);
import {
  Container,
  Aside,
  Menu,
  Submenu,
  Header,
  Main,
  Radio,
  Button,
  Input,
  Table,
  Image,
  Pagination,
  Row,
  Col
} from 'element-ui';
Vue.use(
  Container,
  Aside,
  Menu,
  Submenu,
  Header,
  Main,
  Radio,
  Button,
  Input,
  Table,
  Image,
  Pagination,
  Row,
  Col
  );
Vue.config.productionTip = false;
// VueRouter  3版本之后的都是 升级后变为了promise对象，重复点击路由报错 push replace
// 统一处理catch
const originPush = VueRouter.prototype.push;
VueRouter.prototype.push = function push(location,onResolve,onReject){
  if(onResolve || onReject) return originPush.call(this,location,onResolve,onReject)
  return originPush.call(this,location).catch(err=>err);
}

const originReplace = VueRouter.prototype.replace;
VueRouter.prototype.replace = function replace(location,onResolve,onReject){
  if(onResolve || onReject) return originReplace.call(this,location,onResolve,onReject)
  return originReplace.call(this,location).catch(err=>err);
}
new Vue({
  store,
  router,
  render: h => h(App),
}).$mount('#app')
